//
//  NewsBigImageCell.m
//  JJHW_coreData
//
//  Created by lizhenqiang on 16/4/10.
//  Copyright © 2016年 HFKJ_LZQ. All rights reserved.
//

#import "NewsBigImageCell.h"


@implementation NewsBigImageCell

- (void)awakeFromNib {
    // Initialization code
    self.frame = CGRectMake(0, 0, DeviceWidth, kScaleFrom_iphone6_Desgin(180)+38);//200
    self.myWidth = DeviceWidth;
    self.myHeight = kScaleFrom_iphone6_Desgin(180)+38;
    self.bgImageView.frame = CGRectMake(10, 4, _myWidth-20, kScaleFrom_iphone6_Desgin(180));
//    self.bgImageView.layer.cornerRadius = 10.0f;
//    self.bgImageView.layer.masksToBounds = YES;
    self.bgView.frame = CGRectMake(10, _myHeight-34, _myWidth-20, 30);
    self.bgView.backgroundColor = [UIColor colorWithHex:@"0x666666" alpha:1.0];
    self.contentLabel.frame = CGRectMake(0, 0, self.bgView.frame.size.width, self.bgView.frame.size.height);
    self.bgImageView.contentMode = UIViewContentModeScaleAspectFill;
}

- (CGSize)sizeThatFits:(CGSize)size {
    CGFloat totalHeight = 0;
    totalHeight += self.myHeight;
    return CGSizeMake(size.width, totalHeight);
}

-(void)setCellData:(NewsListObj *)obj
{
    self.contentLabel.text = obj.title;
    NSString *pic = [NSString stringWithFormat:@"%@_%dx%d.jpg",obj.coverImage,(int)DeviceWidth-20,(int)kScaleFrom_iphone6_Desgin(180)];
//    NSString *picStr = [NSString isEmpty:obj.coverImage]?@"":obj.recoImage;

    [self.bgImageView sd_setImageWithURL:[NSURL URLWithString:pic] placeholderImage:kplaceholderImage224];
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    // Configure the view for the selected state
}

@end
